Skip to content

feat(paper-writing): add a resizable LaTeX workbench with PDF annotations - #3870

Merged
nonoqing merged 4 commits into
openBitFun:mainfrom
nonoqing:codex/paper-writing-review
Nov 11, 2026
Merged

nonoqing merged 4 commits into
openBitFun:mainfrom
nonoqing:codex/paper-writing-review

Conversation

@nonoqing

@nonoqing nonoqing commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Extend Paper Writing with independently collapsible, resizable LaTeX source and PDF panes, plus PDF review tools. Include the local-window recovery fix in a separate commit so refreshing during an active turn no longer leaves only the user message visible.

Type and Areas

Motivation / Impact

Opening a workspace .tex file provides source editing alongside a compiled PDF. Either pane can be closed and restored independently while retaining document state. The source toolbar adds outline navigation, snippets, find/replace, main-file selection, and compiler diagnostics.

Body snippets inserted with the cursor or a selection in the preamble now go after the visible \begin{document} boundary. This avoids placing \section before \documentclass or replacing the preamble. Selections already in the body and included chapter files retain cursor-based insertion.

PDF review supports highlights, notes, comment replies and edits, ink, colors, resolve/delete, undo/redo, workspace saves, and controller-side export. Review state is retained beside the source and embedded in exported PDFs; exports use standard PDF annotations. Existing output replacement uses content-hash checks. Recompilation retains page coordinates and warns when the PDF changes.

Reloading a local window during an active turn previously created an empty replay shell without scheduling replay outside Peer Device Mode. Explicitly stale sessions now use the existing fenced journal replay, including duplicate-cursor handling and live suffix delivery. Ordinary local sessions retain their existing read behavior, and older hosts without a journal keep their persisted-content path.

Verification

  • GitHub Actions on b1025b72d4: all 14 checks passed, including the three-platform Rust/CLI matrix, both Linux binary producers, and the final validation gate. CI run. Frontend CI passed 1,263 test files and 14,813 tests.

  • 564 tests passed across 19 focused files on the latest upstream base (57afe3d9e8). Exact command from src/web-ui:

node scripts/run-vitest.mjs run \
  src/tools/editor/pdf-review \
  src/tools/editor/components/{LatexEditor,PdfViewer,CodeEditor}.test.tsx \
  src/tools/editor/services/{MonacoModelManager,editorViewResidency,EditorDocument}.test.ts \
  src/tools/editor/languages/latex.language.test.ts \
  src/tools/editor/utils/latexDocument.test.ts \
  src/infrastructure/file-export/savePdfFile.test.ts \
  src/infrastructure/api/service-api/LatexAPI.test.ts \
  src/app/workbench/ContentResourceView.shortcuts.test.tsx \
  src/flow_chat/store/FlowChatStore.test.ts \
  src/infrastructure/peer-device/runtimeSessionEventGate.test.ts \
  src/flow_chat/services/flow-chat-manager/{PeerSessionRefreshModule,EventHandlerModule,TextChunkModule}.test.ts
  • pnpm run lint:web: passed with 0 errors and 28 nonblocking warnings.
  • pnpm exec tsc --noEmit from src/web-ui: passed.
  • pnpm run i18n:audit, pnpm run theme:color-audit:all, pnpm run appearance:contract-audit, pnpm run theme:visual-contract, and pnpm run check:repo-hygiene: passed.
  • pnpm run fmt:rs, git diff --check, and the Git object-size check against upstream/main: passed.
  • Native LaTeX fixtures: 2 passed, including real pdfLaTeX/XeLaTeX, BibTeX, success logs and error diagnostics. These were rerun using the test binary already built from the unchanged feature-branch Rust source; the three-platform Rust CI matrix has now passed on the PR head.
  • Manual verification in the existing local Desktop: compiled a 16-page paper and independently closed/restored the source and PDF panes. Review interactions, save/reopen and annotated export were also exercised in an isolated local sample workspace.
  • check:web:appearance is blocked by an existing typography violation in unchanged design-system/packages/ui/src/components/Dialog/Dialog.module.css:77 (--openbitfun-line-height-snug). The same file and violation are present on the upstream base.

Reviewer Notes

  • Commits separate the writing workbench from local-window session recovery.
  • Adds pdf-lib 1.17.1 (MIT) for standard PDF annotations and embedded editable review data.
  • The compiler response adds optional success logs; the frontend continues to accept older responses without logs. Compilation still runs on the workspace-owning host.
  • Local Desktop was exercised. Live remote workspace, Remote Connect/bot control, Peer Device Mode, and Detached Dispatch were not tested end to end. Page-coordinate annotations are not SyncTeX or automatic text reanchoring.
  • AI-assisted. Testing level: lightly tested (focused automated coverage and local Desktop verification; the platform matrix is handled by CI).

Screenshot uses a sample paper in an isolated UI fixture:

LaTeX writing workbench and PDF review

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, including skipped checks and the existing typography failure.
  • User-facing strings, docs, and locales are updated where applicable.

@nonoqing
nonoqing merged commit 0c474e3 into openBitFun:main Nov 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant